home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / language / embedded / m68k / fbug68k.arc / ASM68EA.C < prev    next >
Text File  |  1989-08-17  |  16KB  |  655 lines

  1.  
  2. #include "userdef.h"
  3.  
  4. /* ********************************************************************* */
  5. /* additions to userdef.h                        */
  6.  
  7. #define MAXSTR 80
  8. #define SOURCE 0
  9. #define DEST 1
  10. /* ********************************************************************* */
  11.  
  12. /* ************************************************************************ */
  13. /* ROUTINE:EAallowed                                */
  14. /* ************************************************************************ */
  15.  
  16. int EAallowed(strsyntax,SorD,allowableEA)
  17. char *strsyntax;
  18. int SorD;
  19. char allowableEA[];
  20. {
  21. extern char sizechar[];    /* actual letter typed in command ie. andi.b<--- */
  22. extern EASPEC EA[];
  23. extern MIPOST;
  24. extern EAFIELD seperatorfield[];
  25. extern EAFIELD actualfield[];
  26. extern error;
  27.  
  28. char teststring[MAXSTR];    /* another teststring being initialized to
  29.                    protect the original            */
  30. char teststring1[MAXSTR];    /* another teststring being initialized to
  31.                    protect the original            */
  32. char argumentstring[MAXSTR];
  33.  
  34. int i,j;
  35. int s;
  36. int numchars;
  37. int lastallowed,firstallowed;
  38. int actualfields,actualseperators;
  39. int error1;
  40.  
  41. #if(DEVICE==68040 || COPROCESSOR==TRUE)
  42. int j_fp,e_fp;
  43. double f_fp;
  44. int fraction_bits;
  45. double weight;
  46. int precision;
  47.  
  48. j_fp = 0;
  49. e_fp = 0;
  50. f_fp = 0;
  51. fraction_bits = 0;
  52. weight = 0;
  53. precision = 0;
  54. #endif
  55.  
  56. /* **************************** */
  57. /* INITIALIZE EAfields        */
  58. /* **************************** */
  59.  
  60.  
  61. error = FALSE;
  62. error1 = FALSE;
  63. for(i=0;strsyntax[i]!=ENDSTR;i++)
  64.     {
  65.     teststring[i]=strsyntax[i];  /* used for mode 101 and 111.010        */
  66.     teststring1[i]=strsyntax[i]; /* below to determine error & error1  */
  67.     }
  68. teststring[i]=ENDSTR;
  69. teststring1[i]=ENDSTR;
  70.  
  71. /* Check to see if an error is found by getnum before shift ie. MODE 111.0/1  */
  72. if(teststring1[0]==ENDSTR)
  73.     error1=TRUE;
  74. else
  75.     {
  76.     getnum(&teststring1[0],NOERR,DEFAULTSCALE); 
  77.     if(error)
  78.         error1=TRUE;
  79.     else
  80.         error1=FALSE;
  81.     }
  82.  
  83. shiftarg(&teststring[0],1);
  84.  
  85. getnum(&teststring[0],NOERR,DEFAULTSCALE);  /* setup 'error' variable   */
  86.  
  87. /* NOTE: after setting up error any calls from this routine can not use
  88.      the global variable error unless this setting is no longer
  89.      required                        */
  90.  
  91. /* ******************************************** */
  92. /* used in EA's that start with a displacement     */
  93. /* ******************************************** */
  94. for(i=0;((strsyntax[i]!=',') && (strsyntax[i]!=ENDSTR) && (strsyntax[i]!=')') && (i < MAXLINE));i++)
  95.     ;
  96.  
  97. /* ************************** */
  98. /* MODE 000              */
  99. /* ************************** */
  100. if(strsyntax[0]=='d' &&
  101.     strsyntax[1]>='0' &&
  102.     strsyntax[1]<='7' &&
  103.     (strsyntax[2]==','|| strsyntax[2]==ENDSTR || strsyntax[2]=='{'))
  104.     {
  105.     shiftarg(strsyntax,1);        /* removes the 'D' from the string */
  106.     EA[SorD].mode=0;
  107.     EA[SorD].Aregnum= getnum(strsyntax,NOERR,DEFAULTSCALE);
  108.     shiftarg(strsyntax,1);
  109.     EAmatchOK(allowableEA,SorD);
  110.     return;
  111.     }
  112. /* ************************** */
  113. /* MODE 001               */
  114. /* ************************** */
  115. else if(strsyntax[0]=='a' &&
  116.     strsyntax[1]>='0' &&
  117.     strsyntax[1]<='7' &&
  118.     (strsyntax[2]==','|| strsyntax[2]=='\0' || strsyntax[2]=='{'))
  119.     {
  120.     shiftarg(strsyntax,1);
  121.     EA[SorD].mode=1;
  122.     EA[SorD].Aregnum= getnum(strsyntax,NOERR,DEFAULTSCALE);
  123.     shiftarg(strsyntax,1);
  124.     EAmatchOK(allowableEA,SorD);
  125.     return;
  126.     }
  127. /* ************************** */
  128. /* MODE 010              */
  129. /* ************************** */
  130. else if(strsyntax[0]=='(' &&
  131.     strsyntax[1]=='a' &&
  132.     (strsyntax[2]=='0'||strsyntax[2]=='1'||strsyntax[2]=='2'||strsyntax[2]=='3'||strsyntax[2]=='4'||strsyntax[2]=='5'||strsyntax[2]=='6'||strsyntax[2]=='7') &&
  133.     strsyntax[3]==')' &&
  134.     (strsyntax[4]==','|| strsyntax[4]=='\0' || strsyntax[4]=='{'))
  135.     {
  136.     shiftarg(strsyntax,2);
  137.     EA[SorD].mode=2;
  138.     EA[SorD].Aregnum= getnum(strsyntax,NOERR,DEFAULTSCALE);
  139.     shiftarg(strsyntax,2);
  140.     EAmatchOK(allowableEA,SorD);
  141.     return;
  142.     }
  143. /* **************************** */
  144. /* MODE 011            */
  145. /* **************************** */
  146. else if(strsyntax[0]=='(' &&
  147.     strsyntax[1]=='a' &&
  148.     (strsyntax[2]=='0'||strsyntax[2]=='1'||strsyntax[2]=='2'||strsyntax[2]=='3'||strsyntax[2]=='4'||strsyntax[2]=='5'||strsyntax[2]=='6'||strsyntax[2]=='7') &&
  149.     strsyntax[3]==')' &&
  150.     strsyntax[4]=='+' &&
  151.     (strsyntax[5]==','|| strsyntax[5]=='\0' || strsyntax[5]=='{'))
  152.     {
  153.     shiftarg(strsyntax,2);
  154.     EA[SorD].mode=3;
  155.     EA[SorD].Aregnum= getnum(strsyntax,NOERR,DEFAULTSCALE);
  156.     shiftarg(strsyntax,3);
  157.     EAmatchOK(allowableEA,SorD);
  158.     return;
  159.     }
  160. /* **************************** */
  161. /* MODE 100            */
  162. /* **************************** */    
  163. else if(strsyntax[0]=='-' &&
  164.     strsyntax[1]=='(' &&
  165.     strsyntax[2]=='a' &&
  166.     strsyntax[3]>='0' &&
  167.     strsyntax[3]<='7' &&
  168.     strsyntax[4]==')' &&
  169.     (strsyntax[5]==','|| strsyntax[5]=='\0' || strsyntax[5]=='{'))
  170.     {
  171.     shiftarg(strsyntax,3);
  172.     EA[SorD].mode=4;
  173.     EA[SorD].Aregnum= getnum(strsyntax,NOERR,DEFAULTSCALE);
  174.     shiftarg(strsyntax,2);
  175.     EAmatchOK(allowableEA,SorD);
  176.     return;
  177.     }
  178. /* **************************** */
  179. /* MODE 101 and 111.010        */
  180. /* **************************** */    
  181. else if(strsyntax[0]=='(' &&
  182.     strsyntax[i]==',' && 
  183.     ((strsyntax[i+1]=='a' && strsyntax[i+2]>='0' && strsyntax[i+2]<='7')||
  184.     (strsyntax[i+1]=='p' && strsyntax[i+2]=='c')) && 
  185.     strsyntax[i+3]==')' &&
  186.     (strsyntax[i+4]==','|| strsyntax[i+4]=='\0' || strsyntax[i+4]=='{') &&
  187.     !error)
  188.     {
  189.     shiftarg(strsyntax,1);
  190.     if(strsyntax[i]=='a') /*it has been shifted once so 'A' should be at i*/
  191.     {
  192.         EA[SorD].mode=5;
  193.         EA[SorD].dis16=getnum(strsyntax,NOERR,DEFAULTSCALE);
  194.         if(error==TRUE)
  195.             return;    
  196.         shiftarg(strsyntax,2);
  197.         EA[SorD].Aregnum=getnum(strsyntax,NOERR,DEFAULTSCALE);
  198.         if(error==TRUE)
  199.             return;    
  200.     }
  201.     else
  202.     {
  203.         EA[SorD].mode=7;
  204.         EA[SorD].dis16=getnum(strsyntax,NOERR,DEFAULTSCALE);
  205.         if(error==TRUE)
  206.             return;    
  207.         shiftarg(strsyntax,3);
  208.         EA[SorD].Aregnum=2;
  209.     }
  210.     shiftarg(strsyntax,2);
  211.     EAmatchOK(allowableEA,SorD);
  212.     return;
  213.     }
  214. /* **************************** */
  215. /* MODE 111.000 and 111.001    */
  216. /* **************************** */
  217. else if(
  218.     (strsyntax[i]==')' &&
  219.     !error &&
  220.     ((strsyntax[i+1]==',' || strsyntax[i+1]=='\0' || strsyntax[i+1]=='{') ||
  221.     ((strsyntax[i+1]=='.') &&
  222.     (strsyntax[i+2]=='w' || strsyntax[i+2]=='l') &&
  223.     (strsyntax[i+3]==',' || strsyntax[i+3]=='\0' || strsyntax[i+3]=='{'))))||
  224.     (!error1 &&
  225.     (strsyntax[i]==',' || strsyntax[i]=='\0' || strsyntax[i]=='{') &&
  226.     (strsyntax[1]!='[')))
  227.     {
  228.     EA[SorD].mode=7;
  229.     if(strsyntax[0]=='(')
  230.         shiftarg(strsyntax,1);
  231.     EA[SorD].dis16=getnum(strsyntax,NOERR,DEFAULTSCALE);
  232.     switch(strsyntax[2])
  233.     {
  234.         case 'w':
  235.         case 'W':
  236.             EA[SorD].Aregnum=0;
  237.             break;
  238.         case 'L':
  239.         case 'l':
  240.             EA[SorD].Aregnum=1;
  241.             break;
  242.         default:    /* letter not entered */
  243.             if(EA[SorD].dis16==(EA[SorD].dis16 & 0xffff))
  244.                 EA[SorD].Aregnum=0;
  245.             else
  246.                 EA[SorD].Aregnum=1;
  247.             break;
  248.     }
  249.     if(strsyntax[1]=='.')
  250.         shiftarg(strsyntax,2);
  251.     shiftarg(strsyntax,2);
  252.     EAmatchOK(allowableEA,SorD);
  253.     return;
  254.     }
  255. #if(DEVICE == 68040 || COPROCESSOR == TRUE)
  256. /* **************************** */
  257. /* MODE 111.100    #_._E_ FORMAT    */
  258. /* **************************** */
  259. else if(strsyntax[0]=='#')
  260.     {
  261.     if(!error && teststring[0]!='.' && 
  262.          teststring[0]!='_' &&
  263.          (sizechar[0]=='b' || sizechar[0]=='w' || 
  264.           sizechar[0]=='l' || sizechar[0]=='~'))
  265.             {
  266.             if(sizechar[0]=='~')
  267.                 {
  268.                 sizechar[0]='l';
  269.                 sizechar[1]=ENDSTR;
  270.                 }
  271.             shiftarg(strsyntax,1);
  272.             EA[SorD].mode=7;
  273.             EA[SorD].Aregnum=4;
  274.             EA[SorD].immediatedata=getnum(strsyntax,NOERR,DEFAULTSCALE);
  275.             shiftarg(strsyntax,1);
  276.             EAmatchOK(allowableEA,SorD);
  277.             return;
  278.             }
  279.     for(i=0;strsyntax[i]!=ENDSTR;i++)
  280.         teststring[i]=strsyntax[i];  /* reset up this teststring */
  281.     teststring[i]=ENDSTR;
  282.     shiftarg(teststring,1);/* remove # from string */
  283.     if((sizechar[0]=='p' || sizechar[0]=='P') 
  284.         && ((teststring[0]=='-' && teststring[2]!='.')
  285.         || (teststring[0]!='-' && teststring[1]!='.')))
  286.         {
  287.         error = TRUE;
  288.         return;
  289.         }
  290. /* Scan for '.' and '_E or _e' */
  291.     for(i=0,j=0;teststring[i]!=ENDSTR;i++)
  292.         {
  293.         if(teststring[i]=='.' || teststring[i]=='_')
  294.             {
  295.             teststring1[j++]=teststring[i];  /* use this teststring
  296.                                 to maintain which 
  297.                                 letters were found 
  298.                                 in number */
  299.  
  300.             teststring[i]=' ';/* ie. a valid stop symbol recognized
  301.                           by getnum */
  302.             }
  303.         }
  304.     teststring1[j]=ENDSTR;
  305.  
  306.     j_fp = 0;
  307.     f_fp = 0.0;
  308.     e_fp = 0;
  309.     if((teststring[0] == ' ' && teststring1[0]!='.') || 
  310.         teststring1[0]==ENDSTR)
  311.         {
  312.         error = TRUE;
  313.         return;
  314.         }
  315.     if(teststring[0] != ' ')
  316.         {
  317.         j_fp=getnum(teststring,NOERR,REGSCALE);
  318.         if(error)
  319.             return;
  320.         }
  321.     while(teststring1[0] != ENDSTR )
  322.     {
  323.         switch(teststring1[0])
  324.             {
  325.             case '.':
  326.                 precision = getlengthfraction(teststring);
  327.                 f_fp=getnum(teststring,NOERR,REGSCALE);
  328.                 for(i=precision;i>0;i--)
  329.                     f_fp = f_fp/(REGSCALE);
  330.                 break;
  331.             case '_':
  332.                 if(teststring[0]!='E' && teststring[0]!='e')
  333.                     {
  334.                     error = TRUE;
  335.                     break;
  336.                     }
  337.                 shiftarg(teststring,1);
  338.                 e_fp=getnum(teststring,NOERR,REGSCALE);
  339.                 break;
  340.             }
  341.         shiftarg(teststring1,1);
  342.         if(error)
  343.             break;
  344.     }/* end while */
  345.  
  346.     if(error)/* from getting f_fp or e_fp */
  347.         return;
  348.  
  349.     /* j_fp,f_fp,e_fp are now setup the #data for the single,double,
  350.        extended and packed formats will be stored in FP_data[SorD]
  351.        based off whether we are storing SOURCE or DEST immediatedata
  352.        and the format will be determined by the sizechar[0] which for
  353.         floating point instructions defaults to 'x' */
  354.  
  355.  
  356.     if(sizechar[0]=='p' || sizechar[0]=='P')
  357.         {
  358.         for(i=0;strsyntax[i]!=ENDSTR;i++)
  359.             teststring[i]=strsyntax[i];/*reset up this teststring*/
  360.         teststring[i]=ENDSTR;
  361.         }
  362.  
  363.     /* *********** */
  364.     /* SET UP s_fp */
  365.     if(j_fp < 0)
  366.         {
  367.         j_fp = -j_fp;
  368.         EA[SorD].s_fp = 1;/* Note: it was initialized to 0 */
  369.         shiftarg(teststring,1);/* even if not 'p' or 'P' */
  370.         }
  371.     /* *********** */
  372.  
  373.     if(sizechar[0]!='p' && sizechar[0]!='P')
  374.         {
  375.         /* *********** */
  376.         /* SET UP f_fp */
  377.         if(j_fp == 0 && f_fp!=0)
  378.             for(;j_fp == 0; e_fp--)
  379.                 {
  380.                 f_fp = f_fp * 2;
  381.                 j_fp = j_fp + (int) (f_fp);
  382.                 f_fp = f_fp - (int) f_fp;
  383.                 }
  384.         else if(j_fp > 1)
  385.             for(;j_fp > 1; e_fp++)
  386.                 {
  387.                 f_fp = f_fp/2 + ((double) j_fp)/2.0 - (j_fp/2);
  388.                 j_fp = j_fp/2;
  389.                 }
  390.         /* *********** */
  391.         }/* end if */
  392.  
  393.     switch(sizechar[0])
  394.         {
  395.             /* SET UP e_fp              */
  396.             /* Start range checking for error */
  397.         case 's':
  398.         case 'S':
  399.             fraction_bits = 23;
  400.             e_fp = e_fp + 127;
  401.             if(e_fp > 255 || e_fp < 0)
  402.                 error = TRUE;
  403.             break;
  404.         case 'd':
  405.         case 'D':
  406.             fraction_bits = 52;
  407.             e_fp = e_fp + 1023;
  408.             if(e_fp > 2047 || e_fp < 0)
  409.                 error = TRUE;
  410.             break;
  411.         case '~':
  412.         case 'x':
  413.         case 'X':
  414.             fraction_bits = 63;
  415.             e_fp = e_fp + 16383;
  416.             if(e_fp > 32767 || e_fp < 0)
  417.                 error = TRUE;
  418.             break;
  419.         case 'p':
  420.         case 'P':
  421.             if(e_fp < 0)
  422.                 {
  423.                 EA[SorD].s1_fp = 1;
  424.                 e_fp = -e_fp;
  425.                 }
  426.             if(e_fp > 4095)
  427.                 error = TRUE;
  428.             break;
  429.         }
  430.  
  431.     /* Start packing EA[SorD].__fp fields for immediatedata */
  432.     if(error)
  433.         return;
  434.  
  435.     EA[SorD].e_fp  = e_fp;
  436.     if(sizechar[0]!='p' && sizechar[0]!='P')
  437.         {
  438.         for(i=1;i<=fraction_bits;i++)
  439.             {
  440.             for(weight=1,j=i;j>0;j--)
  441.                 weight =  weight * 0.5;
  442.  
  443.             if(f_fp >= weight || 
  444.                  (i == 23 && 
  445.                   fraction_bits == 23 && 
  446.                   f_fp >= (weight * 0.5)))
  447.  
  448.                 {
  449.                 if(fraction_bits == 23)
  450.                     EA[SorD].f1_fp = EA[SorD].f1_fp | 0x1<<(fraction_bits-i);
  451.                 else if(fraction_bits == 52 && i<21)
  452.                     EA[SorD].f1_fp = EA[SorD].f1_fp | 0x1<<(fraction_bits-i-32);
  453.                 else if(fraction_bits == 52)
  454.                     EA[SorD].f2_fp = EA[SorD].f2_fp | 0x1<<(fraction_bits-i);
  455.                 else if(fraction_bits == 63 && i<32)
  456.                     EA[SorD].f1_fp = EA[SorD].f1_fp | 0x1<<(fraction_bits-i-32);
  457.                 else if(fraction_bits == 63)
  458.                     EA[SorD].f2_fp = EA[SorD].f2_fp | 0x1<<(fraction_bits-i);
  459.                 f_fp = f_fp - weight;
  460.                 }/* end if */
  461.             }/* end for */
  462.         }/* end if */
  463.     else
  464.         {
  465.         shiftarg(teststring,1);/* remove the # sign again */
  466.         EA[SorD].p_fp = teststring[0]-'0';
  467.         shiftarg(teststring,2);/* remove th e'.' also */
  468.         for(i=7;i>=0 && teststring[0]!='_' && teststring[0]!=',' && teststring[0]!=ENDSTR;i--)
  469.             {
  470.             EA[SorD].f1_fp = EA[SorD].f1_fp | (teststring[0]-'0'<<(i*4));
  471.             shiftarg(teststring,1);
  472.             }
  473.         for(i=7;i>=0 && teststring[0]!='_' && teststring[0]!=',' && teststring[0]!=ENDSTR;i--)
  474.             {
  475.             EA[SorD].f2_fp = EA[SorD].f2_fp | (teststring[0]-'0'<<(i*4));
  476.             shiftarg(teststring,1);
  477.             }
  478.         }/* end else */
  479.     for(;strsyntax[0]!=',' && strsyntax[0]!=ENDSTR;shiftarg(strsyntax,1))
  480.         ;
  481.     EA[SorD].mode=7;
  482.     EA[SorD].Aregnum=4;
  483.     shiftarg(strsyntax,1);/* remove the ',' */
  484.     EAmatchOK(allowableEA,SorD);
  485.     return;
  486.     }/* end else if */
  487. #else
  488. /* **************************** */
  489. /* MODE 111.100            */
  490. /* **************************** */
  491. else if(strsyntax[0]=='#' && !error)
  492.     {
  493.     shiftarg(strsyntax,1);
  494.     EA[SorD].mode=7;
  495.     EA[SorD].Aregnum=4;
  496.     EA[SorD].immediatedata=getnum(strsyntax,NOERR,DEFAULTSCALE);
  497.     shiftarg(strsyntax,1);
  498.     EAmatchOK(allowableEA,SorD);
  499.     return;
  500.     }
  501. #endif
  502. /* **************************** */
  503. /* MODE 110 and MODE 111.011    */
  504. /* **************************** */    
  505. else if(strsyntax[0]!='(')
  506.     {
  507.     error=TRUE;
  508.     return;
  509.     }
  510. for(i=0;strsyntax[i]!=')' && i<=MAXSTR;i++)
  511.     {
  512.     if( i==MAXSTR )
  513.         break;
  514.     }
  515.  
  516. if(i==MAXSTR || ( strsyntax[i+1] != ',' && strsyntax[i+1] != '\0' && strsyntax[i+1]!='{'))
  517.     {
  518.     error=TRUE;
  519.     return;
  520.     }
  521. /* ie. does the EA end in a ')'    */
  522.  
  523.  
  524. EA[SorD].mode=6;    /* NOTE: it may still be changed to 111 later */
  525. for(j=0;strsyntax[j]!=ENDSTR;j++)
  526.     argumentstring[j]=strsyntax[j];
  527. argumentstring[j]=ENDSTR;
  528.  
  529. shiftarg(strsyntax,i+2);/* remove the source EA and posible ',' */
  530.  
  531. s=0;
  532. actualfields=0;
  533. actualseperators=0;
  534.  
  535. while(argumentstring[0]!=')' && actualfields<=5 )
  536. {
  537.     if((argumentstring[0]=='[' && argumentstring[1]==',') ||
  538.         (argumentstring[0]== ','&& argumentstring[1]==']') ||
  539.         (argumentstring[0]== ','&& argumentstring[1]==',') ||
  540.         (argumentstring[0]== '('&& argumentstring[1]==',') ||
  541.         (argumentstring[0]== ','&& argumentstring[1]==')'))
  542.         {
  543.         if(argumentstring[0]=='[')
  544.             {
  545.             seperatorfield[s].field[0]=argumentstring[0];
  546.             actualseperators++;
  547.             }
  548.         actualfield[actualfields].field[0]=',';
  549.         actualfield[actualfields].field[1]=ENDSTR;
  550.         actualfields++;
  551.         s++;
  552.         shiftarg(argumentstring,1);
  553.         }
  554.     else if(argumentstring[0]== ',')
  555.         shiftarg(argumentstring,1);
  556.     else if(argumentstring[0]== '(')
  557.         shiftarg(argumentstring,1);
  558.     else if(argumentstring[0]== '['|| argumentstring[0]==']')
  559.         {
  560.         seperatorfield[s].field[0]=argumentstring[0];
  561.         actualseperators++;
  562.         shiftarg(argumentstring,1);
  563.         if(argumentstring[0]==',' &&
  564.                  seperatorfield[s].field[0]==']' &&
  565.                  argumentstring[1]!=',' &&
  566.                  argumentstring[1]!=' ' &&
  567.                  argumentstring[1]!=')')
  568.             shiftarg(argumentstring,1);
  569.         }
  570.     else
  571.         {
  572.         error=FALSE;
  573.         numchars=getarglength(argumentstring);
  574.         if(error)
  575.             return;
  576.         for(i=0;i<=numchars;i++)
  577.             actualfield[actualfields].field[i]=argumentstring[i];
  578.         actualfield[actualfields].field[i]=ENDSTR;
  579.         shiftarg(argumentstring,numchars);
  580.         actualfields++;
  581.         s++;
  582.         }
  583. }
  584.  
  585. /* actual format should be ,_,_,_,_, where the fields are a0,a1,a2,a3 and
  586.    the ','s are actually s0,s1,s2,s3,s4 as represented by actualfields
  587.    and actual seperators: Note actual seperators are only '[' or ']'.If
  588.    the s0-4 field had either a '[' or ']' in it then this is the character
  589.    that is copied into the seperatorfield[].field. If not then the characters
  590.    that were there are put into the actualfiled[].field. Regardless everytime
  591.    an actual field is entered the seperator field increments.        */ 
  592.  
  593. #if (DEVICE>=68020)
  594. if(actualseperators==2 && actualfields!=4)
  595.     {
  596.     error=TRUE;
  597.     return;
  598.     }
  599.  
  600. if(actualfields>4 || (actualseperators!=0 && actualseperators!=2))
  601.     {
  602.     error=TRUE;
  603.     return;
  604.     }
  605.  
  606. if(actualseperators==2 && 
  607.     (seperatorfield[0].field[0]!='[' || 
  608.     (seperatorfield[2].field[0]!=']' && seperatorfield[3].field[0] != ']')))
  609.     {
  610.     error=TRUE;
  611.     return;
  612.     }
  613.  
  614. if(actualseperators==2 && seperatorfield[2].field[0]==']')
  615.     MIPOST=TRUE;
  616. else
  617.     MIPOST=FALSE;
  618.  
  619. #else
  620. if(actualseperators!=0 || actualfields!=3)
  621.     {
  622.     print("\nillegal mode 68000 device");
  623.     error=TRUE;
  624.     return;
  625.     }
  626. #endif
  627.  
  628. /* actualfields end in either a ENDSTR or , character            */
  629.  
  630. switch(actualseperators)
  631.     {
  632.     case 0:
  633.         lastallowed=3;
  634.         break;
  635.     case 2:
  636.         lastallowed=4;
  637.         break;
  638.     }
  639.  
  640. firstallowed=1;
  641.  
  642. for(i=0;i<=actualfields-1;i++)
  643. {
  644.     firstallowed=EAplacement(SorD,i,&firstallowed,&lastallowed);
  645.     if(firstallowed==-1)
  646.         {
  647.         error=TRUE;
  648.         return;
  649.         }
  650. }    
  651. error=FALSE;
  652. EAmatchOK(allowableEA,SorD);
  653. return;
  654. }
  655.